Fix: Skip UnitaryGate instances during BasisTranslator#15916
Fix: Skip UnitaryGate instances during BasisTranslator#15916raynelfss wants to merge 4 commits intoQiskit:mainfrom
BasisTranslator#15916Conversation
…slator`. - A well known bug introduced by Qiskit#14659 in which the `AerSimulator` is known to define `UnitaryGate` as part of its target basis. However, `BasisTranslator` should not include `UnitaryGate` as part of its calculations, it should instead be handled by `UnitarySynthesis`. - To fix this, `BasisTranslator` skips any `UnitaryGate` in the circuit by filtering its `op_nodes` to check for any `UnitaryGate` instances. - The only question left is whether we should still have the panic condition in `name_to_packed_operation` because this check is done on a name basis rather than instance.
|
One or more of the following people are relevant to this code:
|
I'd like to bring this up again, in case it is a genuine concern. Since most of this fix might be superseded by #15684, we won't need to even go through Python in the future. |
BasisTraslatorBasisTranslator
|
Where specifically is the panic? We shouldn't be panicking in general on the name |
I agree with this @mtreinish. I mistakenly added this in the past believing that there was no way we'd end up ever retrieving or querying a The panic happens specifically during the Ideally, it would be best to throw away this panic condition in favor of just going through Python instead since #15684 will modify this to perform all tasks from rust. |
Summary
Fixes #15278
Fixes #15733
BasisTranslatorrust-native. #14659 in which theAerSimulatoris known to defineUnitaryGateas part of its target basis. However,BasisTranslatorshould not includeUnitaryGateas part of its calculations, it should instead be handled byUnitarySynthesis.BasisTranslatorskips anyUnitaryGatein the circuit by filtering itsop_nodesto check for anyUnitaryGateinstances.Details and comments
The only question left is whether we should still have the panic condition in
name_to_packed_operationbecause this check is done on a name basis rather than instance.